<?php




/**
* Sorts albumsizes by changing the sinking weight.
* Extended fetures can sort teh data within the set of record (categories) only.
*/

$relationship_id = $variable->get('id', 'integer', 0);
$code = $variable->get('code', 'string', ''); # For future references

# Find out the direction to sort. Go upwards or downloads in the list.
$direction = strtolower($variable->get('direction', 'string', 'down'));
$direction = (in_array($direction, array('up', 'down')))?$direction:'down';

# Match active records (and  optionally other condistions)
$sorter = new sorter("AND `is_active`='Y'");
$sorter->sort_table('gallery_albums_sizes', 'relationship_id', $relationship_id, $direction, 'sink_weight');

$messenger = new messenger('warning', 'The record has been sorted.');

# This is a controller only page and does not have anything to display.
headers::back('albumsizes-list.php');
#stopper::url(url::last_page('albumsizes-list.php'));
?>